Repository navigation
Stop a program whose output readers can't start, and warn when -KillTreeOnExit can't reach a program's tree - #111
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three changes for 4.2, together in one PR:
A program whose output readers can't start is stopped.
Start-PkProcessCorestarted the stdout and stderr reader threads (PkStreamReadTask.Run) only after the program was running, on both start paths, with nothing to undo the start if one failed. If a reader thread couldn't be created, the start threw without returning the program, so the batch and the dispatcher had nothing to kill: the program kept running untracked, with nothing reading its output. Now the readers start in atry; on a failure the program and what it started are stopped (Stop-PkProcessTree), a reader that never started is closed, and the start fails with "could not start ... its output couldn't be read", which the batch and the dispatcher report as aStartError.-KillTreeOnExitwarns when it can't reach a program's tree. It kills through the program's own Job Object. For a program without one (Windows refused it, the kit has no Job Object, or a custom starter started the program), it did nothing, silently.Stop-PkExitedJobTree, which all three engines use for it, now warns once per process. The README's-KillTreeOnExitparagraph and the parameter help say so, and add thatStartModeCreatedInJobdescribes how programs start, not whether each one got its own Job Object."Choosing limits" says each running program takes two threads, one per output stream.
C#: a test hook,
PkStreamReadTask.TestFailRunAfter, makes a reader start throw;PkChildProcessJobgetsHasTreeand a once-only claim for the new warning.TypesVersiongoes from 14 to 15, so a session that loaded an older copy needs a new window.Tests (failing before the change, on Windows PowerShell 5.1):
CreateProcesspath and theProcess.Startpath, and the stderr one in a batch. Before: 5 [FAIL], each with the program and its child (2 processes) left running. After: each start fails with "could not start" and nothing is left running.-KillTreeOnExit, in the batch and the dispatcher (no tree job) andInvoke-PkProcessWithTimeout(Windows refusing it): the child is still left alone, now with one warning naming-KillTreeOnExit, and a second program in the same process gets no second warning. Before: 4 [FAIL], 0 messages.The full harness passed on Windows PowerShell 5.1 and PowerShell 7.6.2, one after the other (748 assertions each),
-AsModule -Section MODULEon both, andBuild/Update-ParallelKitCSharp.ps1 -Check -Compile(csc.exe4.8 as C# 5 and the .NET 10 SDK atLangVersion5, no warnings).